package com.xlhj.boot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xlhj.boot.entity.SysLogInfo;
import com.xlhj.boot.entity.SysUserInfo;
import com.xlhj.boot.mapper.SysLogInfoMapper;
import com.xlhj.boot.mapper.SysUserInfoMapper;
import com.xlhj.boot.service.SysUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: caijliu
 * @Date: 08/09/2021 10:35
 * @Description TODO
 * @Vsersion: 0.0.1
 */
@Service
public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUserInfo> implements SysUserInfoService {

    @Autowired
    private SysLogInfoMapper logInfoMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveUserInfoAndLogInfo(SysUserInfo userInfo, String rocketmqKeys) {
        this.save(userInfo);
        SysLogInfo logInfo = new SysLogInfo();
        logInfo.setTxId(rocketmqKeys);
        logInfoMapper.insert(logInfo);
    }
}
